﻿@model ConfigurationModel

@using Nop.Plugin.Misc.SendinBlue
@using Nop.Plugin.Misc.SendinBlue.Models

@{
    Layout = "_ConfigurePlugin";
    Html.AddCssFileParts("~/Plugins/Misc.SendinBlue/Content/styles.css", excludeFromBundle: true);
}

@await Component.InvokeAsync("StoreScopeConfiguration")

<form asp-controller="SendinBlue" asp-action="Configure" method="post">
    <nop-panels id="sendinblue-panels">
        <nop-panel asp-name="sendinblue-general" asp-icon="fa fa-info" asp-title="@T("Plugins.Misc.SendinBlue.General")" asp-hide-block-attribute-name="@SendinBlueDefaults.HideGeneralBlock" asp-hide="@Model.HideGeneralBlock" asp-advanced="false">
            <div class="panel-group">
                <div class="panel panel-default">
                    <div class="panel-body">
                        @if (!string.IsNullOrEmpty(Model.AccountInfo))
                        {
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-label asp-for="ApiKey" />
                                </div>
                                <div class="col-md-9">
                                    <nop-editor asp-for="ApiKey" />
                                    <span asp-validation-for="ApiKey"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-label asp-for="AccountInfo" />
                                </div>
                                <div class="col-md-9" style="white-space: pre-line">
                                    @Html.Raw(Model.AccountInfo)
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-9 col-md-offset-3">
                                    <input type="submit" name="save" class="btn btn-primary" value="@T("Admin.Common.Save")" />
                                </div>
                            </div>
                        }
                        else
                        {
                            <div class="custombody">
                                <div class="form-group">
                                    <div class="logo">
                                        <img src="@Url.Content("~/Plugins/Misc.SendinBlue/logo.png")" alt="" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <h2>Step 1. Create a SendinBlue account</h2>
                                    <p>
                                        Drive more sales with all-in-one marketing software platform.
                                    </p>
                                </div>
                                <div class="form-group">
                                    <ul class="list-unstyled">
                                        <li>
                                            <i class="fa fa-check"></i><b>Design</b> clean and professional newsletters
                                        </li>
                                        <li>
                                            <i class="fa fa-check"></i>Buid and <b>target</b> your audience
                                        </li>
                                        <li>
                                            <i class="fa fa-check"></i><b>Automate</b> your marketing (e.g. abandoned cart recovery)
                                        </li>
                                    </ul>
                                </div>
                                <div class="form-group">
                                    <div>
                                        <a href="https://app.sendinblue.com/account/login/?utm_source=nopcommerce_plugin&utm_medium=plugin&utm_campaign=module_link" class="btn btn-primary" target="_blank">Create Free Account</a>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <h2>Step 2. Connect your store to SendinBlue</h2>
                                    <p>Copy your API v3 key from your SendinBlue account on <a href="https://account.sendinblue.com/advanced/api/?utm_source=nopcommerce_plugin&utm_medium=plugin&utm_campaign=module_link" target="_blank">SMTP & API</a> page, then paste it in the field below and save.</p>
                                    <div class="apikey">
                                        <input class="form-control text-box single-line" id="ApiKey" name="ApiKey" type="text" value="" placeholder="xkeysib-xxxxxxxxxxx">
                                        <span asp-validation-for="ApiKey"></span>
                                    </div>

                                </div>
                                <div class="form-group">
                                    <input type="submit" name="save" class="btn btn-primary" value="@T("Admin.Common.Save")" />
                                </div>
                                <div class="form-group">
                                    <h2>Need help?</h2>
                                    <p>Take a look at our tutorials:</p>
                                    <ul class="list">
                                        <li>
                                            <a href="https://help.sendinblue.com/hc/en-us/articles/360004172879/?utm_source=nopcommerce_plugin&utm_medium=plugin&utm_campaign=module_link" target="_blank">nopCommerce - 1. Set up the plugin</a>
                                        </li>
                                        <li>
                                            <a href="https://help.sendinblue.com/hc/en-us/articles/360004172899/?utm_source=nopcommerce_plugin&utm_medium=plugin&utm_campaign=module_link" target="_blank">nopCommerce - 2. Recover abandoned carts</a>
                                        </li>
                                        <li>
                                            <a href="https://help.sendinblue.com/hc/en-us/articles/360004172939/?utm_source=nopcommerce_plugin&utm_medium=plugin&utm_campaign=module_link" target="_blank">nopCommerce - 3. Send an order confirmation email</a>
                                        </li>
                                    </ul>
                                </div>
                                <br />
                                <div class="form-group">
                                    <p><b><i>Don’t see your question answered?</i></b></p>
                                    <ul class="list">
                                        <li>
                                            <i>Visit <a href="https://www.nopcommerce.com/boards/" target="_blank">nopCommerce forums</a>. They are free and mostly provided by nopCommerce community (sometimes by nopCommerce team).</i>
                                        </li>
                                        <li>
                                            <i><a href="https://www.nopcommerce.com/nopcommerce-premium-support-services" target="_blank">nopCommerce premium support services</a>. Paid, fast and provided by nopCommerce team.</i>
                                        </li>
                                        <li>
                                            <i>Post the issue on nopCommerce <a href="https://github.com/nopSolutions/sendinblue-plugin-for-nopcommerce/issues" target="_blank">plugin repository</a>.</i>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        }
                    </div>
                </div>
            </div>
        </nop-panel>
        @if (!string.IsNullOrEmpty(Model.ApiKey))
        {
            <nop-panel asp-name="sendinblue-synchronization" asp-icon="fa fa-exchange" asp-title="@T("Plugins.Misc.SendinBlue.Synchronization")" asp-hide-block-attribute-name="@SendinBlueDefaults.HideSynchronizationBlock" asp-hide="@Model.HideSynchronizationBlock" asp-advanced="false">
                <script>
                    $(document).ready(function () {
                        $("#progressBar").kendoProgressBar({
                            value: false,
                            type: "value"
                        }).data("kendoProgressBar");
                        $("#progressBar").hide();

                        if (@((ViewData["synchronizationStart"] != null && (bool)ViewData["synchronizationStart"]).ToString().ToLower())) {
                            $("#progressBar").show();
                            refresh();
                        }
                    });

                    function refresh(){
                        setTimeout(function(){
                            $.get('@(Url.Action("GetSynchronizationInfo", "SendinBlue"))', function(data) {
                                if (!data) {
                                    refresh();
                                }
                                else {
                                    $('#synchronizationInfo').text(data);
                                    $("#progressBar").hide();
                                }
                            });
                        }, 3000);
                    };

                </script>

                <div class="panel-group">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <p>
                                From the dropdown list below, select the SendinBlue list where your nopCommerce newsletter subscribers and their data will be added.<br />
                                After the initial sync, a task is scheduled to run every 6000 seconds to automatically add your new subscribers to your SendinBlue list.<br />
                                To change the sync frequency, go to <a href="@Url.Content("~/Admin/ScheduleTask/List/")">System > Schedule tasks.</a>
                            </p>
                            <div class="form-group">
                                <div class="col-md-9 col-md-offset-3">
                                    <a href="https://my.sendinblue.com/lists/?utm_source=nopcommerce_plugin&utm_medium=plugin&utm_campaign=module_link" class="btn btn-primary" target="_blank">Create a list</a>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-override-store-checkbox asp-for="ListId_OverrideForStore" asp-input="ListId" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                    <nop-label asp-for="ListId" />
                                </div>
                                <div class="col-md-9">
                                    <nop-select asp-for="ListId" asp-items="Model.AvailableLists" />
                                    <span asp-validation-for="ListId"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-9 col-md-offset-3">
                                    <input type="submit" name="saveSync" class="btn btn-primary" value="@T("Admin.Common.Save")" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            @T("Plugins.Misc.SendinBlue.ManualSync")
                        </div>
                        <div class="panel-body">
                            <p>
                                To run the sync right away, click on the "Sync now" button.
                            </p>
                            <div id="synchronizationInfo" style="white-space: pre-line"></div>
                            <div id="progressBar"></div>
                        </div>
                        <div class="panel-footer">
                            <button type="submit" name="sync" class="btn bg-primary">
                                @T("Plugins.Misc.SendinBlue.SyncNow")
                            </button>
                        </div>
                    </div>
                </div>
            </nop-panel>
            <nop-panel asp-name="sendinblue-transactional" asp-icon="fa fa-envelope" asp-title="@T("Plugins.Misc.SendinBlue.Transactional")" asp-hide-block-attribute-name="@SendinBlueDefaults.HideTransactionalBlock" asp-hide="@Model.HideTransactionalBlock" asp-advanced="false">
                <div class="panel-group">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <p>
                                SendinBlue SMTP is the transactional email service of SendinBlue. When it is enabled, all transactional emails (e.g. account creation emails, order confirmation emails, recovery password emails, etc) of your store will be sent from your SendinBlue account.<br />
                                Copy your SMTP key from your SendinBlue account on <a href="https://account.sendinblue.com/advanced/api/?utm_source=nopcommerce_plugin&utm_medium=plugin&utm_campaign=module_link" target="_blank">SMTP & API</a> page > SMTP tab, then paste it in the field below and save.
                            </p>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-override-store-checkbox asp-for="UseSmtp_OverrideForStore" asp-input="UseSmtp" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                    <nop-label asp-for="UseSmtp" />
                                </div>
                                <div class="col-md-9">
                                    <nop-editor asp-for="UseSmtp" />
                                    <span asp-validation-for="UseSmtp"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-label asp-for="SmtpKey" />
                                </div>
                                <div class="col-md-9">
                                    <nop-editor asp-for="SmtpKey" />
                                    <span asp-validation-for="SmtpKey"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-override-store-checkbox asp-for="SenderId_OverrideForStore" asp-input="SenderId" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                    <nop-label asp-for="SenderId" />
                                </div>
                                <div class="col-md-9">
                                    <nop-select asp-for="SenderId" asp-items=" Model.AvailableSenders" />
                                    <span asp-validation-for="SenderId"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-9 col-md-offset-3">
                                    <input type="submit" name="saveSMTP" class="btn btn-primary" value="@T("Admin.Common.Save")" />
                                </div>
                            </div>
                        </div>
                    </div>

                    @if (Model.UseSmtp)
                    {
                        <div class="panel panel-default">
                            <div class="panel-body">
                                @await Html.PartialAsync("Table", new DataTablesModel
                                {
                                    Name = "messages-grid",
                                    UrlRead = new DataUrl("MessageList", "SendinBlue", null),
                                    UrlUpdate = new DataUrl("MessageUpdate", "SendinBlue", null),
                                    Length = Model.MessageTemplateSearchModel.PageSize,
                                    LengthMenu = Model.MessageTemplateSearchModel.AvailablePageSizes,
                                    ColumnCollection = new List<ColumnProperty>
                                    {
                                        new ColumnProperty(nameof(SendinBlueMessageTemplateModel.Name))
                                        {
                                            Title = T("Admin.ContentManagement.MessageTemplates.Fields.Name").Text
                                        },
                                        new ColumnProperty(nameof(SendinBlueMessageTemplateModel.IsActive))
                                        {
                                            Title = T("Admin.ContentManagement.MessageTemplates.Fields.IsActive").Text,
                                            Width = "100",
                                            ClassName = NopColumnClassDefaults.CenterAll,
                                            Render = new RenderBoolean(),
                                            Editable = true,
                                            EditType = EditType.Checkbox
                                        },
                                        new ColumnProperty(nameof(SendinBlueMessageTemplateModel.ListOfStores))
                                        {
                                            Title = T("Admin.ContentManagement.MessageTemplates.Fields.LimitedToStores").Text
                                        },
                                        new ColumnProperty(nameof(SendinBlueMessageTemplateModel.UseSendinBlueTemplate))
                                        {
                                            Title = T("Plugins.Misc.SendinBlue.UseSendinBlueTemplate").Text,
                                            Width = "100",
                                            ClassName = NopColumnClassDefaults.CenterAll,
                                            Render = new RenderBoolean(),
                                            Editable = true,
                                            EditType = EditType.Checkbox
                                        },
                                        new ColumnProperty(nameof(SendinBlueMessageTemplateModel.Id))
                                        {
                                            Title = T("Plugins.Misc.SendinBlue.EditTemplate").Text,
                                            Width = "150",
                                            Render = new RenderLink(new DataUrl(string.Empty, nameof(SendinBlueMessageTemplateModel.EditLink)))
                                            {
                                                Title = T("Plugins.Misc.SendinBlue.EditTemplate").Text
                                            }
                                        },
                                        new ColumnProperty(nameof(SendinBlueMessageTemplateModel.Id))
                                        {
                                            Title = T("Admin.Common.Edit").Text,
                                            Width = "200",
                                            ClassName =  NopColumnClassDefaults.Button,
                                            Render = new RenderButtonsInlineEdit()
                                        }
                                    }
                                })
                            </div>
                        </div>
                    }
                </div>
            </nop-panel>
            <nop-panel asp-name="sendinblue-sms" asp-icon="fa fa-envelope-o" asp-title="@T("Plugins.Misc.SendinBlue.SMS")" asp-hide-block-attribute-name="@SendinBlueDefaults.HideSmsBlock" asp-hide="@Model.HideSmsBlock" asp-advanced="false">
                <div class="panel-group">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <p>
                                You can send personalized SMS notifications to your customers or the store owner. Simply make sure that you have SMS credits (estimate how many SMS credits you need with this <a href="https://www.sendinblue.com/pricing?utm_source=nopcommerce_plugin&utm_medium=plugin&utm_campaign=module_link" target="_blank">calculator</a> - the cost of an SMS depends on the recipient’s country) and that sending transactional SMS is enabled on your SendinBlue account.
                            </p>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-override-store-checkbox asp-for="UseSmsNotifications_OverrideForStore" asp-input="UseSmsNotifications" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                    <nop-label asp-for="UseSmsNotifications" />
                                </div>
                                <div class="col-md-9">
                                    <nop-editor asp-for="UseSmsNotifications" />
                                    <span asp-validation-for="UseSmsNotifications"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-override-store-checkbox asp-for="SmsSenderName_OverrideForStore" asp-input="SmsSenderName" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                    <nop-label asp-for="SmsSenderName" />
                                </div>
                                <div class="col-md-9">
                                    <nop-editor asp-for="SmsSenderName" />
                                    <span asp-validation-for="SmsSenderName"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-label asp-for="StoreOwnerPhoneNumber" />
                                </div>
                                <div class="col-md-9">
                                    <nop-editor asp-for="StoreOwnerPhoneNumber" />
                                    <span asp-validation-for="StoreOwnerPhoneNumber"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-9 col-md-offset-3">
                                    <input type="submit" name="saveSMS" class="btn btn-primary" value="@T("Admin.Common.Save")" />
                                </div>
                            </div>
                        </div>
                    </div>

                    @if (Model.UseSmsNotifications)
                    {
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <div class="form-group">
                                    <div class="col-md-3">
                                        <nop-label asp-for="AllowedTokens" />
                                    </div>
                                    <div class="col-md-9">
                                        <a id="allowedTokensShowHide" href="javascript:toggleLoadedAllowedTokens();">@T("Admin.Common.Show")</a>
                                        <div id="pnlAllowedTokens" style="display: none; white-space: pre-line">
                                            <div class="form-text-row">@Model.AllowedTokens</div>
                                        </div>
                                    </div>
                                </div>
                                <script>
                                    function toggleLoadedAllowedTokens() {
                                        $('#pnlAllowedTokens').toggle();
                                        if ($('#pnlAllowedTokens').css('display') == 'none') {
                                            $('#allowedTokensShowHide').html('@T("Admin.Common.Show")');
                                        } else {
                                            $('#allowedTokensShowHide').html('@T("Admin.Common.Hide")');
                                        }
                                    }
                                </script>

                                @await Html.PartialAsync("Table", new DataTablesModel
                                {
                                    Name = "sms-grid",
                                    UrlRead = new DataUrl("SMSList", "SendinBlue", null),
                                    UrlDelete = new DataUrl("SMSDelete", "SendinBlue", null),
                                    Length = Model.SmsSearchModel.PageSize,
                                    LengthMenu = Model.SmsSearchModel.AvailablePageSizes,
                                    ColumnCollection = new List<ColumnProperty>
                                    {
                                        new ColumnProperty(nameof(SmsModel.Name))
                                        {
                                            Title = T("Admin.ContentManagement.MessageTemplates.Fields.Name").Text,
                                            Width = "300",
                                        },
                                        new ColumnProperty(nameof(SmsModel.PhoneType))
                                        {
                                            Title = T("Plugins.Misc.SendinBlue.PhoneType").Text,
                                            Width = "200",
                                        },
                                        new ColumnProperty(nameof(SmsModel.Text))
                                        {
                                            Title = T("Plugins.Misc.SendinBlue.SMSText").Text,
                                            Width = "500"
                                        },
                                        new ColumnProperty(nameof(SmsModel.Id))
                                        {
                                            Title = T("Admin.Common.Delete").Text,
                                            Width = "100",
                                            ClassName =  NopColumnClassDefaults.Button,
                                            Render = new RenderButtonRemove(T("Admin.Common.Delete").Text)
                                        }
                                    }
                                })
                                <div class="panel panel-default no-margin">
                                    <div class="panel-heading">
                                        @T("Admin.Common.AddNewRecord")
                                    </div>
                                    <div class="panel-body">
                                        <div class="form-group">
                                            <div class="col-md-3">
                                                <nop-label asp-for="@Model.AddSms.MessageId" />
                                            </div>
                                            <div class="col-md-9">
                                                <nop-select asp-for="@Model.AddSms.MessageId" asp-items="@Model.AddSms.AvailableMessages" />
                                                <span asp-validation-for="@Model.AddSms.MessageId"></span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-md-3">
                                                <nop-label asp-for="@Model.AddSms.PhoneTypeId" />
                                            </div>
                                            <div class="col-md-9">
                                                <nop-select asp-for="@Model.AddSms.PhoneTypeId" asp-items="@Model.AddSms.AvailablePhoneTypes" />
                                                <span asp-validation-for="@Model.AddSms.PhoneTypeId"></span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-md-3">
                                                <nop-label asp-for="@Model.AddSms.Text" />
                                            </div>
                                            <div class="col-md-9">
                                                <nop-textarea asp-for="@Model.AddSms.Text" />
                                                <span asp-validation-for="@Model.AddSms.Text"></span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-md-9 col-md-offset-3">
                                                <button type="button" id="addSms" class="btn btn-primary">@T("Admin.Common.AddNewRecord")</button>
                                            </div>
                                        </div>
                                    </div>
                                    <script>
                                        $(document).ready(function () {
                                            $('#addSms').click(function () {
                                                $('#addSms').attr('disabled', true);
                                                var postData = {
                                                    MessageId: $("#@Html.IdFor(model => model.AddSms.MessageId)").val(),
                                                    PhoneTypeId: $("#@Html.IdFor(model => model.AddSms.PhoneTypeId)").val(),
                                                    Text: $("#@Html.IdFor(model => model.AddSms.Text)").val()
                                                };
                                                addAntiForgeryToken(postData);
                                                $.ajax({
                                                    cache: false,
                                                    type: "POST",
                                                    url: "@Html.Raw(Url.Action("SMSAdd", "SendinBlue"))",
                                                    data: postData,
                                                    success: function (data, textStatus, jqXHR) {
                                                        if (data.Result) {
                                                            updateTable('#sms-grid');

                                                            //clear input value
                                                            $("#@Html.IdFor(model => model.AddSms.MessageId)").val(@(Model.AddSms.DefaultSelectedMessageId));
                                                            $("#@Html.IdFor(model => model.AddSms.PhoneTypeId)").val(@(Model.AddSms.DefaultSelectedPhoneTypeId));
                                                            $("#@Html.IdFor(model => model.AddSms.Text)").val('');

                                                        } else {
                                                            display_nop_error(data);
                                                        }
                                                    },
                                                    complete: function (jqXHR, textStatus) {
                                                        $('#addSms').attr('disabled', false);
                                                    }
                                                });
                                            });
                                        });
                                    </script>
                                </div>
                            </div>
                        </div>
                    }

                    <div class="panel panel-default">
                        <div class="panel-heading">
                            @T("Plugins.Misc.SendinBlue.SMS.Campaigns")
                        </div>
                        <div class="panel-body">
                            <p>
                                Send a SMS campaign to a SendinBlue list.
                            </p>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-label asp-for="CampaignListId" />
                                </div>
                                <div class="col-md-9">
                                    <nop-select asp-for="CampaignListId" asp-items="Model.AvailableLists" />
                                    <span asp-validation-for="CampaignListId"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-label asp-for="CampaignSenderName" />
                                </div>
                                <div class="col-md-9">
                                    <nop-editor asp-for="CampaignSenderName" />
                                    <span asp-validation-for="CampaignSenderName"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-label asp-for="CampaignText" />
                                </div>
                                <div class="col-md-9">
                                    <nop-textarea asp-for="CampaignText" />
                                    <span asp-validation-for="CampaignText"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-9 col-md-offset-3">
                                    <input type="submit" name="submitCampaign" class="btn btn-primary" value="@T("Plugins.Misc.SendinBlue.SMS.Campaigns.Submit")" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </nop-panel>
            <nop-panel asp-name="sendinblue-ma" asp-icon="fa fa-star" asp-title="@T("Plugins.Misc.SendinBlue.MarketingAutomation")" asp-hide-block-attribute-name="@SendinBlueDefaults.HideMarketingAutomationBlock" asp-hide="@Model.HideMarketingAutomationBlock" asp-advanced="false">
                <div class="panel-group">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            @if (Model.MarketingAutomationDisabled)
                            {
                                <p>
                                    Your Marketing Automation platform is disabled, to activate it, go to this <a href="https://automation.sendinblue.com/?utm_source=nopcommerce_plugin&utm_medium=plugin&utm_campaign=module_link" target="_blank">page</a> and click on the TRY AUTOMATION FOR FREE button.
                                </p>
                            }
                            else
                            {
                                <p>
                                    Automate your marketing - send a series of emails or SMS once a visitor has signed up, a prospect has abandoned their cart, a customer has made a purchase, etc. The plugin will automatically track the activity of shoppers for you to set up workflows to recover lost sales.<br />
                                </p>
                            }
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-override-store-checkbox asp-for="UseMarketingAutomation_OverrideForStore" asp-input="UseMarketingAutomation" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                    <nop-label asp-for="UseMarketingAutomation" />
                                </div>
                                <div class="col-md-9">
                                    <nop-editor asp-for="UseMarketingAutomation" />
                                    <span asp-validation-for="UseMarketingAutomation"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-label asp-for="MarketingAutomationKey" />
                                </div>
                                <div class="col-md-9">
                                    <nop-editor asp-for="MarketingAutomationKey" />
                                    <span asp-validation-for="MarketingAutomationKey"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-3">
                                    <nop-label asp-for="TrackingScript" />
                                </div>
                                <div class="col-md-9">
                                    <nop-textarea asp-for="TrackingScript" />
                                    <script>
                                        $(document).ready(function() {
                                            $('#@Html.IdFor(model => model.TrackingScript)').height($('#@Html.IdFor(model => model.TrackingScript)')[0].scrollHeight);
                                        });
                                    </script>
                                    <span asp-validation-for="TrackingScript"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-9 col-md-offset-3">
                                    <input type="submit" name="saveMA" class="btn btn-primary" value="@T("Admin.Common.Save")" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </nop-panel>
        }
    </nop-panels>
</form>